package com.heima.article;

import com.heima.api.IArticleClientFeign;
import com.heima.article.service.ApArticleService;
import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.common.dtos.ResponseResult;
import freemarker.template.TemplateException;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@RequestMapping("/api/v2/articleClient")
public class ArticleClient {

    private ApArticleService apArticleService;

    /**
     * 保存文章内容+文章配置+文章信息
     * @param dto
     * @return
     */
    @PostMapping("/save")
    public ResponseResult save(@RequestBody ArticleDto dto) throws TemplateException, IOException {
        return apArticleService.save(dto);
    }
}
